package com.xyh.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @Author:kyle
 * @Date:2020/12/23 - 11:29
 * @Project:spring_StudentsDormitoryManagementSystem
 * @Package:com.xyh.po
 * @Version:1.0
 */
@Getter
@Setter
@NoArgsConstructor
@Component
@TableName("t_student")
public class Student implements Serializable {
    @TableId(value = "student_pkid",type = IdType.AUTO)
    private Integer id;
    @TableField(value = "student_name")
    private String name;
    @TableField(value = "student_gender")
    private String gender;
    @TableField(value = "student_tel")
    private String tel;

    @TableField(value = "student_intime")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date inTime;//入住时间
    @TableField(value = "student_headPic")
    private String headPicture;

    @TableField(value = "fk_classid")
    private Integer fkClassId;
    @TableField(exist = false)
    private List<MyClass>  myClasses;
    @TableField(value = "fk_homeid")
    private Integer fkHomeId;
    @TableField(exist = false)
    private List<Home> homes;


    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", gender='" + gender + '\'' +
                ", tel='" + tel + '\'' +
                ", inTime=" + inTime +
                ", headPicture='" + headPicture + '\'' +
                ", fkClassId=" + fkClassId +
                ", myClasses=" + myClasses +
                ", fkHomeId=" + fkHomeId +
                ", homes=" + homes +
                '}';
    }
}
